class Solution:
    """没有完全理解为什么是最小公约数的倍数就可以了"""
    def canMeasureWater(self, x: int, y: int, z: int) -> bool:
        if z == 0:
            return True
        if x + y < z:
            return False
        if x > y:
            x, y = y, x
        if x == 0:
            return y == z
        while y % x != 0:
            y, x = x, y % x
        return z % x == 0


a = Solution()
print(a.canMeasureWater(7, 9, 4))
